const {
	saveParameterMethod,
} = require('./api-parameter-methods')
const {
	dialogClose,
} = require('./api-utils')

module.exports = function(apiComp) {
	let {
		parameterDialog,
		parameterForm,
		parameterName,
		parameterMandatory,
		parameterType,
		parameterContent,
		parameterRemark,
	} = apiComp

	// 初始化对话框
	parameterDialog.dialog({
		title: '参数添加',
		top: 80,
		left: 400,
		width: 600,
		height: 480,
		closed: true,
		modal: true,
		buttons: [{
			text: '确定',
			iconCls: 'icon-redo',
			handler: function() {
				saveParameterMethod.call(apiComp)
			}
		}, {
			text: '取消',
			iconCls: 'icon-cancel',
			handler: function() {
				parameterDialog.dialog('close')
			}
		}],
		onClose() {
			dialogClose.call(apiComp)
		},
	})

}